<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="s" uri="/struts-tags"%>

<br/>
<%-- Success Messages --%>
<c:if test="${not empty messages}">
    <div class="message" id="successMessages">
        <c:forEach var="msg" items="${messages}">
            <img src="<c:url value="/images/iconInformation.gif"/>"
                 alt="<fmt:message key="icon.information"/>" class="icon" />
            <c:out value="${msg}"/><br />
        </c:forEach>
    </div>
    <c:remove var="messages" scope="session"/>
</c:if>

<%-- Error Messages (on JSPs, not through Struts --%>
<c:if test="${not empty errors}">
    <div class="error" id="errorMessages">
        <c:forEach var="error" items="${errors}">
            <img src="<c:url value="/images/iconWarning.gif"/>"
                 alt="<fmt:message key="icon.warning"/>" class="icon" />
            <c:out value="${error}"/><br />
        </c:forEach>
    </div>
    <c:remove var="errors" scope="session"/>
</c:if>
<br/>
<div>
    <table class="table" id="asistanceControlList">
        <caption><fmt:message key="asistanceControlList.heading"/></caption>
        <thead>
            <tr>
                <th><fmt:message key="edit"/></th>
                <th><fmt:message key="asistanceControl.date"/></th>
                <th><fmt:message key="asistanceControl.halfDay"/></th>
            </tr>
        </thead>
        <tbody>
            <s:if test="asistancesControl.size > 0">
                <s:iterator value="asistancesControl" status="status">
                    <tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>" onclick="editAsistance(this);" style="cursor: pointer;">
                        <td><img src="<c:url value="/images/edit.png" />"</td>
                        <td><s:property value="date" /></td>
                        <td><s:if test="%{halfDay}" >
                                <fmt:message key="asistanceControl.true"/>
                            </s:if>
                            <s:else>
                                <fmt:message key="asistanceControl.false"/>
                        </s:else></td>
                    </tr>
                </s:iterator>
            </s:if>
            <s:else>
                <tr class="empty"><td colspan="4"><fmt:message key="empty" /></td></tr>
            </s:else>
        </tbody>
    </table>
</div>